﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using AcctrueWMS.Foundation.DAL;
namespace AcctruePMS.Bll.Manager
{
     public class ProjectdismembermentManager
    {
         /// <summary>
         /// 根据报告ID获取对应项目中的分解项
         /// </summary>
         /// <param name="repotGuid"></param>
         /// <returns></returns>
         public DataTable GetDismembermentByReportGUID(string repotGuid) {

             if (string.IsNullOrEmpty(repotGuid))
             {
                 return new DataTable();
             }
             string sql = "select projectdismemberment.projectGUID, projectdismemberment.itemName, projectdismemberment.itemCode, projectdismemberment.itemChecked, projectdismemberment.execID, projectdismemberment.execStatus, projectdismemberment.execDesc, projectdismemberment.Doc, projectdismemberment.upfileGUID, projectdismemberment.expectedTime, projectdismemberment.realTime from projectQuestion inner join projectdismemberment on (projectQuestion.projectGUID=projectdismemberment.projectGUID) where repotGuid='" + repotGuid + "'";
             try
             {
                 return WMSqlExcuter.ExecuteDataTable(sql);
             }
             catch (SqlException ex)
             {

                 return new DataTable();
             }
         }

         /// <summary>
         /// 根据项目ID获取对应项目中的分解项
         /// </summary>
         /// <param name="repotGuid"></param>
         /// <returns></returns>
         public DataTable GetDismembermentByProjectGUID(string projectGuid)
         {

             if (string.IsNullOrEmpty(projectGuid))
             {
                 return new DataTable();
             }
             string sql = "select projectGUID, itemName, itemCode, itemChecked, execID, execStatus, execDesc, Doc, upfileGUID, expectedTime, realTime from projectdismemberment  where projectGUID='" + projectGuid + "'";
             try
             {
                 return WMSqlExcuter.ExecuteDataTable(sql);
             }
             catch (SqlException ex)
             {

                 return new DataTable();
             }
         }
    }
}
